import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Solution500 {

    Map<Character,Integer> map=new HashMap<>();
    public Solution500(){
        map.put('q',1);map.put('w',1);map.put('e',1);map.put('r',1);map.put('t',1);map.put('y',1);map.put('u',1);map.put('i',1);map.put('o',1);map.put('p',1);
        map.put('a',2);map.put('s',2);map.put('d',2);map.put('f',2);map.put('g',2);map.put('h',2);map.put('j',2);map.put('k',2);map.put('l',2);
        map.put('z',3);map.put('x',3);map.put('c',3);map.put('v',3);map.put('b',3);map.put('n',3);map.put('m',3);
    }

    public String[] findWords(String[] words) {
        List<String> list=new ArrayList<>();
        for (String word : words) {
            String w=word.toLowerCase();
            int flag=map.get(w.charAt(0));
            boolean f=true;
            for (int i=1;i<w.length();i++){
                if (map.get(w.charAt(i))!=flag){
                    f=false;
                    break;
                }
            }
            if (f){
                list.add(word);
            }
        }
        String[] strings=new String[list.size()];
        for (int i=0;i<strings.length;i++){
            strings[i]=list.get(i);
        }
        return strings;
    }

    public static void main(String[] args) {
        System.out.println(new Solution500().findWords(new String[]{"Hello","Alaska","Dad","Peace"}).length);
    }
}
